package com.cseg674.dataentry.javaparser;
/*
 * RdfConstructor.java
 *
 * Created on February 28, 2008, 11:07 AM
 *
 */

/**
 *
 * @author Tian, Juan
 */
import java.util.LinkedList;
/**
 * RdfConstructor provides the attributes and methods that define a Constructor in the RDF output.
 */
public class RdfConstructor extends RdfTreeNode{
    /**
	 * Contains the list of methods that are called from within the Constructor
	 */
    LinkedList <String> calls;
    /**
	 * Contains the list of parameters that are passed into the Constructor
     */
    LinkedList <RdfParam> params;
    /**
	 * Cntains the list of exceptions thrown by the Constructor
     */
    LinkedList <RdfException> exceptions;
    /**
	 * Cntains the list of uncertains
     */
    LinkedList <String> uncertains; //need parser again
    /**
	 * Default Constructor: Creates a new instance of RdfConstructor
     */
    public RdfConstructor() {
        this("default");
    }
    /**
	 * Constructor: Creates a new instance of RdfConstructor
	 *
	 * @param perfix	the prefix of the Constructor
     */
    public RdfConstructor(String perfix) {
        this(perfix, null, null);
    }
    /**
	 * Constructor: Creates a new instance of RdfConstructor
	 *
	 *  @param name	the name of the Constructor
	 *  @param type	the type of the Constructor
     */
    public RdfConstructor(String name, String type){
        this("default", name, type);
    }

    /**
	 * Constructor: Creates a new instance of RdfConstructor
	 *
	 * @param perfix	the prefix of the Constructor
	 * @param name		the name of the Constructor
	 * @param type		the type of the Constructor
     */
    public RdfConstructor(String perfix, String name, String type) {
        super(perfix, name, type);
        calls = new LinkedList<String>();
        params = new LinkedList<RdfParam>();
        exceptions = new LinkedList<RdfException>();
        uncertains = new LinkedList<String>();
    }

    /**
	 * adds the uncertain 'a' to the list of uncertains that are called by this Constructor
	 *
	 * @param a	the uncertain of the Constructor
	 * @return	<code>true</code> if the uncertain was successfully added to the 'uncertains' list
     */
    public boolean addUncertain(String a){
        return uncertains.add(a);
    }

    /**
	 * removes the uncertain 'a' from the list of uncertains that are called by this Constructor
	 *
	 * @param a	the uncertain of the Constructor
	 * @return	<code>true</code> if the uncertain was successfully removed to the 'uncertains' list
     */
    public boolean removeUncertain(String a) {
        return uncertains.remove(a);
    }

    /**
	 * removes the uncertain from the list of uncertains that are called by this Constructor
	 *
	 * @param i	the index of the uncertain of the Constructor from the 'uncertains' list
	 * @return	the uncertain was successfully removed to the 'uncertains' list
     */
    public String removeUncertain(int i) {
        return uncertains.remove(i);
    }

    /**
	 * gets the uncertain from the list of uncertains that are called by this Constructor
	 *
	 * @param i	the index of the uncertain of the Constructor from the 'uncertains' list
	 * @return	the uncertain from the 'uncertains' list at index 'i'
     */
    public String getUncertain(int i) {
        return uncertains.get(i);
    }

    /**
	 * add a call 'a' to the list of calls that are called by this Constructor
	 *
	 * @param a	the call of the Constructor from the 'calls' list
	 * @return	<code>true</code> if the call was successfully added to the 'calls' list
     */
    public boolean addCall(String a) {
        return calls.add(a);
    }

    /**
	 * adds the parameter 'a' to the list of parameters that are used by this Constructor
	 *
	 * @param a	the parameter of the Constructor from the 'parameters' list
	 * @return	<code>true</code> if the parameter was successfully added to the 'parameters' list
     */
    public boolean addParam(RdfParam a) {
        return params.add(a);
    }

    /**
	 * adds the exception 'a' to the list of exceptions that are called by this Constructor
	 *
	 * @param a	the exception thrown by the Constructor from the 'exceptions' list
	 * @return	<code>true</code> if the exception was successfully added to the 'exceptions' list
     */
    public boolean addException(RdfException a) {
        return exceptions.add(a);
    }
}
